package com.gxa.ssm251.service.impl;


import com.gxa.ssm251.exception.BusinessException;
import com.gxa.ssm251.mapper.PointsMapper;
import com.gxa.ssm251.pojo.Points;
import com.gxa.ssm251.service.PointsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 舒空
 */

@Service("pointsService")
public class PointsServiceImpl implements PointsService {


    @Resource
    private PointsMapper pointsMapper;




    @Override
    //创建事务
    @Transactional(propagation = Propagation.REQUIRED)

    public Integer addPoints(Points points){
            return pointsMapper.insert(points);
    }

    @Override
    public Integer update(Points points) {
        return pointsMapper.update(points);
    }


    @Override
    public Integer delete(Integer id) {
        return pointsMapper.delete(id);
    }

    @Override
    public Points selectById(Integer id) {
        return pointsMapper.selectById(id);
    }

    @Override
    public List<Points> selectPointsAll() {
        return pointsMapper.selectAll();
    }

    @Override
    public List<Points> selectAllByPage(Integer page, Integer size) {
        return pointsMapper.selectAllByPage(page,size);
    }


}
